package com.mlxg.master.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mlxg.master.domain.HzExhibitor;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
  * <p>
  * 展商 Mapper 接口
  * </p>
  *
 @author zcy
  * @date 2025/5/23 9:50
  */

@Mapper
public interface HzExhibitorSourceMapper extends BaseMapper<HzExhibitor> {

    // Mapper中添加的方法
    @Select("SELECT he1.id " +
            "FROM hz_exhibitor he1 " +
            "WHERE he1.del_flag = '0' " +
            "  AND he1.company_name_c IS NOT NULL " +
            "  AND he1.id = ( " +
            "    SELECT he2.id " +
            "    FROM hz_exhibitor he2 " +
            "    WHERE he2.regist_account = he1.regist_account " +
            "      AND he2.del_flag = '0' " +
            "      AND he2.company_name_c IS NOT NULL " +
            "    ORDER BY he2.create_date DESC, he2.id DESC " +
            "    LIMIT 1 " +
            ")")
    List<String> selectLatestExhibitorIds();

}
